<?php

/**
 * @author christian
 * @copyright 2011
 * @abstract carga de todo el itinerario que es parte de un tour del itenario del tour
 */
 
 

$ruta=$_SERVER['DOCUMENT_ROOT']."/viventura"."/MDTour";
$ruta2=$_SERVER['DOCUMENT_ROOT']."/viventura"."/MDOperator";
include_once("$ruta/conf/CConfig.php");
include_once("$ruta/elements/head.tpl");
include_once("$ruta/view/MDPacksDraw.php");
include_once("$ruta/view/CDrawMenuTour.php");
include_once("$ruta/MDTourGeneral/CDrawPageReg.php");
include_once("$ruta/MDTourGeneral/CTourEditDraw.php");
include_once("$ruta/star.php");

include_once("$ruta/view/CDrawReload.php");

include_once("$ruta2/MDOperatorServicio/CResumeServicesTable.php");


include_once("$ruta/ReloadPages/js/reloader.php");
include_once("$ruta/ReloadPages/js/reloader2.php");



if (!isset($_GET['idOpe'])) {$_GET['idOpe'] = "NULL"; }
if (!isset($_GET['nval'])) {$_GET['nval'] = "NULL"; }
$idOpe=$_GET['idOpe'];
$nval=base64_decode($_GET['nval']);

$titOpe="";$filter="";
if($idOpe!="NULL"){
    $titOpe = " del Operador <em>$nval</em> ($idOpe)";
    $filter = "where OFICINAS_idOfi IN (Select idOfi from oficinas where OPERADOR_idOpe=$idOpe)";

}


//CDrawMenuTour::getinstance()->setMenuDisplay($items);

CDrawMenuTour::getInstance()->DrawDivAdBegin("content_area_user_title","1");echo "<h1>Paquetes turísticos".$titOpe."</h1>";
CDrawMenuTour::getInstance()->rigth_side_begin();//empieza lado derecho 

$maintable="pack"; //se pasa el id de la tabla que relaciona track y tour


$columnas=array("idPack"=>"id","CostPerOne"=>"Costo por persona","NomPack"=>"Nombre del paquete","IntComPack"=>"Descripción del paquete");
MDPacksDraw::getInstance()->DrawTable("",$maintable,$columnas,$filter);



if($idOpe>=1){
    $columnas = array("ResPackTour"=>"Id", "DesSer"=>"Servicio", "CanIteRec"=>"Cantidad", "PriUni"=>"Precio", "CommSer"=>"Descripción");
    CResumeServicesTable::getInstance()->DrawTable("Servicios del operador $idOpe","","",$columnas,$idOpe);

}
//$table="oficinas";
//$campos=array("idOfi","DirOfi");
//$name="Oficina";
//MDPacksDraw::getInstance()->DrawSelect($table,$campos,$name);


$PagAct=1;$PagUlt=2;$ref="1";$PagSig=1;
      echo "<div class='pagination'>";
                    echo "<a  class='pagination_number' onclick=\"recargar('1','$ref')\">Primero</a> ";
                    if($PagAct>1) echo "<a class='pagination_previous' onclick=\"recargar('$PagAnt','$ref')\">Anterior</a> ";
                    echo "<strong>Pagina ".$PagAct."/".$PagUlt."</strong>";
                    if($PagAct<$PagUlt)  echo " <a class='pagination_next' onclick=\"recargar('$PagSig','$ref')\">Siguiente</a> ";
                    echo "<a   class='pagination_number' onclick=\"recargar('$PagUlt','$ref')\">Ultimo</a>";
        echo "</div>";



////////////////////////////////
$action="view/test.php";$method="post"; //solo paso default, el codigo lo recogo en CTourEdit
CDrawPageReg::getInstance()->DrawHeadAjax($action,$method,"1");

CDrawPageReg::getInstance()->DrawSubmmit("Filtrar");

CTourEditDraw::getInstance()->HiddenValue(1,"next");

CDrawPageReg::getInstance()->DrawDivAjax();

CDrawPageReg::getInstance()->DrawFoot();
//include_once("$ruta/elements/foot.tpl");
////////////////////////////////////



$action="view/test.php";$method="post"; //solo paso default, el codigo lo recogo en CTourEdit
CDrawPageReg::getInstance()->DrawHeadAjax2($action,$method,"2");


$operadores = array("Operador"=>"idOpe","Nombre del Operador"=>"NamOpe");
CTourEditDraw::getInstance()->DrawMultiple("operador",$operadores,"Operadores");

echo "</br><p align='right'>";

CDrawPageReg::getInstance()->DrawSubmmit("Filtrar");
CDrawPageReg::getInstance()->DrawDivAjax();

echo "</p>";

CDrawPageReg::getInstance()->DrawFoot();
//include_once("$ruta/elements/foot.tpl");














echo date("Y-m-d H:i:s");

CDrawPageReg::getInstance()->DrawHideSectionBeg();

    
    echo "<p align='center'>";
    $action="../MDTour/MDTourGeneral/CRegistroTour.php?default=1&basic=1";$name="formulario_registro";$method="post";$NAME="Registro de paquete turístico";
    CDrawPageReg::getInstance()->DrawHead($action,$name,$method,$NAME);
    echo "</p>";
    CDrawPageReg::getInstance()->readOnly("pack","idPack");
    
    $paquete =array("NomPack"=>"Nombre del paquete");
    $val_paquete = array (":required");
    CDrawPageReg::getInstance()->DrawTextBox($paquete,$val_paquete);
    
     echo "<rigth><h2>Datos del Operador</h2><rigth>";
    
    //////////////////////Operadores y oficinas //////////////////////////
    $operador = array("idOpe"=>"idOpe", "NamOpe"=>"NamOpe");
        echo "<div id='dashboard_info'>";
    CDrawPageReg::getInstance()->DrawDependence("operador", $operador, "Operador", "idOpe","view/suboperadores.php");
        echo "</div>";
    
    $comments = array ("IntComPack"=>"Descripción del paquete");
    $val_comments = array (":min_length;4 :max_length;255");
    CDrawPageReg::getInstance()->DrawTextBoxArea($comments,$val_comments);  
    
   
    //$oficinas = array("idOfi"=>"idOfi", "DirOfi"=>"DirOfi");
    //CDrawPageReg::getInstance()->DrawSelect("oficinas", $oficinas, "Oficinas", "idOfi");
    
    echo "<rigth></br><h2>Costos del paquete </h2><rigth>";
    $ahead_behind=array("CostPerOne"=>"Costo por persona","CostPerTwo"=>"Costo por dos personas");
    $val_ahead = array ("","");
    CDrawPageReg::getInstance()->DrawTextBox($ahead_behind,$val_ahead);
    
    echo "<rigth><h2>Fechas de disponibilidad</h2><rigth>";
    echo "<div id='dashboard_info'>";
    $boundaries = array("Desde","hasta");
    CDrawPageReg::getInstance()->DateFromTo("El paquete estará activo:",$boundaries);
    echo "</div>";
 
    //,"AvaPack"=>"Disponible" ,"OFICINAS_idOfi"=>"oficinas",
    
     echo "<h2>Datos del Default Tour</h2>";
    echo "<div id='dashboard_info'>";
    
    $val_default_tour = array (":integer",":integer",":required",":required");
    $default_tour=array("MinPax"=>"Cantidad mínimo de pasajeros","MaxPax"=>"Cantidad máxima de pasajeros","OriTour"=>"Origen","DestTour"=>"Destino");
    CDrawPageReg::getInstance()->DrawTextBox($default_tour,$val_default_tour);

    
   
    echo "<rigth><h2>Datos del Tour Conductor</h2><rigth>";
    $campos = array("idGuide"=>"idGuide", "FirstNamGui"=>"FirstNamGui", " LastNamGui"=> "LastNamGui");
    CDrawPageReg::getInstance()->DrawSelectNon("guidetc", $campos, "Tour Conductor", "idGuide1");
    CDrawPageReg::getInstance()->DrawSelectNon("guidetc", $campos, "Tour Conductor", "idGuide2");
    
   
    echo "</div>";
    
     echo "<rigth><h2>Extensiones </h2><rigth>";
    $extensiones=array('IdExt','NomExt');
    CTourEditDraw::getInstance()->DrawMultipleSelect("pack_has_tour_has_extensiones","extensiones",$extensiones,"Extensiones","NULL","extensiones_idExt");

    $comments2 = array ("ExtComPack"=>"Observaciones externas");
    $val_comments2 = array (":min_length;0 :max_length;255");
    CDrawPageReg::getInstance()->DrawTextBoxArea($comments2,$val_comments2);   
    
    echo "<p align='right'>";
    
        
    CDrawPageReg::getInstance()->DrawSubmmit("Añadir");
        
    echo "</p>";
    echo "</div>";
   
CDrawPageReg::getInstance()->DrawHideSectionEnd("Añadir paquete / Ocultar");

CDrawPageReg::getInstance()->DrawFoot();
CDrawMenuTour::getInstance()->rigth_side_end();

CDrawPageReg::getInstance()->DrawButton("Ver default tours","MDTourGeneral/index.php?default=1");
   
CDrawMenuTour::getInstance()->DrawDivAdEnd();



?>


<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
    $('#example').dataTable( {
        "bPaginate": true,
        "bLengthChange": false,
        "bFilter": true,
        "bSort": true,
        "bInfo": true,
        "bAutoWidth": false
    } );
</script>


<script type="text/javascript">
    function eliminar() {
    document.getElementById('ajax_loader').innerHTML='';
}
</script>
